<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../../print.css" type="text/css" media="print">
<meta content="Maps,org.as3commons.collections.utils.Maps,addFromArgs,addFromArray,addFromMap,addFromObject,clone,copy,itemForOrAdd,itemForOrError,itemForOrValue,newLinkedMap,newMap,newSortedMap" name="keywords">
<title>org.as3commons.collections.utils.Maps</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'Maps - AS3Commons Collections 1.3.2';
				var baseRef = '../../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">AS3Commons Collections 1.3.2</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../index-list.html')" href="../../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../../index.html?org/as3commons/collections/utils/Maps.html&amp;org/as3commons/collections/utils/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Maps</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Maps"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">org.as3commons.collections.utils</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Maps</td>
</tr>
</table>
<p></p>
  <code>IMap</code> utilities.
  
  <p id="link_MapsAddFromExample"><strong><code>Maps.addFrom...()</code> example</strong></p>
  
  <a class="exampleCollapsed" href="#link_MapsAddFromExample" onClick="toggleExample(this, 'MapsAddFromExample');">Show example</a><br /><div id="MapsAddFromExample" style='display:none'><div class='listing'><pre>package {
    import org.as3commons.collections.LinkedMap;
    import org.as3commons.collections.framework.IMapIterator;
    import org.as3commons.collections.utils.Maps;
    import flash.display.Sprite;
    import flash.utils.Dictionary;

    public class MapsAddFromExample extends Sprite {

        public function MapsAddFromExample() {
            // map to populate
            var map : LinkedMap = new LinkedMap();

            // from object (no order)
            var o : Object = {
                1: "1",
                "2": "two"
            };
            Maps.addFromObject(map, o);

            // from dictionary (no order)
            var d : Dictionary = new Dictionary();
            d["2"] = "two (2)"; // ignored by map
            d[3] = "3";
            d["4"] = "four";
            Maps.addFromObject(map, d);

            // from array (ordered)
            var a : Array = [
                3, "3 (2)", // ignored by map
                5, "5",
                "6", "six"
            ];
            Maps.addFromArray(map, a);

            // from map (ordered)
            var m : LinkedMap = new LinkedMap();
            m.add("6", "six (2)"); // ignored by map
            m.add(7, "7");
            m.add("8", "eight");
            Maps.addFromMap(map, m);

            // from args (ordered)
            Maps.addFromArgs(map,
                "8", "eight (2)", // ignored by map
                9, "9",
                "10", "ten"
            );

            // test
            var i : IMapIterator = map.iterator() as IMapIterator;
            while (i.next()) trace (i.key, "=&gt;", i.current);
            
            //    1 =&gt; 1            // from object
            //    2 =&gt; two
            //    4 =&gt; four        // from dictionary
            //    3 =&gt; 3
            //    5 =&gt; 5            // from array
            //    6 =&gt; six
            //    7 =&gt; 7            // from linked map
            //    8 =&gt; eight
            //    9 =&gt; 9            // from args
            //    10 =&gt; ten
        }

    }
}
</pre></div></div>
  
  <p id="link_MapsCloneExample"><strong><code>Maps.clone()</code> example</strong></p>
  
  <a class="exampleCollapsed" href="#link_MapsCloneExample" onClick="toggleExample(this, 'MapsCloneExample');">Show example</a><br /><div id="MapsCloneExample" style='display:none'><div class='listing'><pre>package {
    import org.as3commons.collections.utils.NumericComparator;
    import flash.utils.getQualifiedClassName;
    import org.as3commons.collections.framework.IMap;
    import org.as3commons.collections.framework.IMapIterator;
    import org.as3commons.collections.utils.Maps;
    import flash.display.Sprite;

    public class MapsCloneExample extends Sprite {

        public function MapsCloneExample() {
            // clone simple map
            var map : IMap = Maps.newMap(
                "two", 2, "four", 4, "one", 1, "three", 3
            );
            var clone : IMap = Maps.clone(map);
            dumpMap(clone);
            trace (getQualifiedClassName(clone));
            //    three =&gt; 3
            //    four =&gt; 4
            //    one =&gt; 1
            //    two =&gt; 2
            //    org.as3commons.collections::Map
            
            // clone linked map
            map = Maps.newLinkedMap(
                "two", 2, "four", 4, "one", 1, "three", 3
            );
            clone = Maps.clone(map);
            dumpMap(clone);
            trace (getQualifiedClassName(clone));
            //    two =&gt; 2
            //    four =&gt; 4
            //    one =&gt; 1
            //    three =&gt; 3
            //    org.as3commons.collections::LinkedMap

            // clone sorted map
            map = Maps.newSortedMap(
                new NumericComparator(),
                "two", 2, "four", 4, "one", 1, "three", 3
            );
            clone = Maps.clone(map);
            dumpMap(clone);
            trace (getQualifiedClassName(clone));
            //    one =&gt; 1
            //    two =&gt; 2
            //    three =&gt; 3
            //    four =&gt; 4
            //    org.as3commons.collections::SortedMap
        }
        
        private function dumpMap(map : IMap) : void {
            var i : IMapIterator = map.iterator() as IMapIterator;
            while (i.next()) trace (i.key, "=&gt;", i.current);
        }
    }
}
</pre></div></div>
  
  <p id="link_MapsCopyExample"><strong><code>Maps.copy()</code> example</strong></p>
  
  <a class="exampleCollapsed" href="#link_MapsCopyExample" onClick="toggleExample(this, 'MapsCopyExample');">Show example</a><br /><div id="MapsCopyExample" style='display:none'><div class='listing'><pre>package {
    import org.as3commons.collections.framework.IMap;
    import org.as3commons.collections.framework.IMapIterator;
    import org.as3commons.collections.utils.Maps;
    import org.as3commons.collections.utils.NumericComparator;
    import flash.display.Sprite;

    public class MapsCopyExample extends Sprite {
        public function MapsCopyExample() {
            // source
            var source : IMap = Maps.newLinkedMap(
                1, 1, 2, 1,
                3, 2, 4, 2 
            );
            dumpMap(source);
            //    1 =&gt; 1
            //    2 =&gt; 1
            //    3 =&gt; 2
            //    4 =&gt; 2
            
            // copy all
            var map : IMap = Maps.newSortedMap(
                new NumericComparator(),
                5, 3, 6, 3,
                7, 4, 8, 4
            );
            dumpMap(map);
            //    5 =&gt; 3
            //    6 =&gt; 3
            //    7 =&gt; 4
            //    8 =&gt; 4
            Maps.copy(source, map);
            dumpMap(map);
            //    1 =&gt; 1
            //    2 =&gt; 1
            //    3 =&gt; 2
            //    4 =&gt; 2
            //    5 =&gt; 3
            //    6 =&gt; 3
            //    7 =&gt; 4
            //    8 =&gt; 4

            // copy only even keys
            map = Maps.newSortedMap(
                new NumericComparator(),
                6, 3,
                8, 4
            );
            dumpMap(map);
            //    6 =&gt; 3
            //    8 =&gt; 4
            Maps.copy(source, map, evenFilter);
            dumpMap(map);
            //    2 =&gt; 1
            //    4 =&gt; 2
            //    6 =&gt; 3
            //    8 =&gt; 4

            // copy only even items
            map = Maps.newSortedMap(
                new NumericComparator(),
                7, 4, 8, 4
            );
            dumpMap(map);
            //    7 =&gt; 4
            //    8 =&gt; 4
            Maps.copy(source, map, null, evenFilter);
            dumpMap(map);
            //    3 =&gt; 2
            //    4 =&gt; 2
            //    7 =&gt; 4
            //    8 =&gt; 4

            // copy only even keys with even items
            map = Maps.newSortedMap(
                new NumericComparator(),
                8, 4
            );
            dumpMap(map);
            //    8 =&gt; 4
            Maps.copy(source, map, evenFilter, evenFilter);
            dumpMap(map);
            //    4 =&gt; 2
            //    8 =&gt; 4
        }
        
        private function evenFilter(item :  : Boolean {
            return item % 2 == 0;
        }

        private function dumpMap(map : IMap) : void {
            var i : IMapIterator = map.iterator() as IMapIterator;
            while (i.next()) trace (i.key, "=&gt;", i.current);
            trace();
        }

    }
}
</pre></div></div>
  
  <p id="link_AddFromArgsExample"><strong><code>Maps.new...()</code> example</strong></p>
  
  <a class="exampleCollapsed" href="#link_AddFromArgsExample" onClick="toggleExample(this, 'AddFromArgsExample');">Show example</a><br /><div id="AddFromArgsExample" style='display:none'><div class='listing'><pre>package {
    import org.as3commons.collections.framework.
    import org.as3commons.collections.utils.
    import flash.display.Sprite;

    public class AddFromArgsExample extends Sprite {

        public function AddFromArgsExample() {
            // ArrayList
            var list : IList = Lists.newArrayList(
                1, 2, 3, 4, 5, 6, 7, 8
            );
            trace (list.toArray() + "n");
            // 1, 2, 3, 4, 5, 6, 7, 8
            
            // ArrayList
            list = Lists.newSortedList(
                new NumericComparator(),
                6, 3, 1, 5, 8, 2, 7, 4
            );
            trace (list.toArray() + "n");
            // 1, 2, 3, 4, 5, 6, 7, 8
            
            // Set
            var theSet : ISet = Sets.newSet(
                1, 2, 3, 4, 5, 6, 7, 8
            );
            trace (theSet.toArray() + "n");
            // 1, 2, 3, 4, 5, 6, 7, 8
            
            // LinkedSet
            theSet = Sets.newLinkedSet(
                1, 2, 3, 4, 5, 6, 7, 8
            );
            trace (theSet.toArray() + "n");
            // 1, 2, 3, 4, 5, 6, 7, 8
            
            // SortedSet
            theSet = Sets.newSortedSet(
                new NumericComparator(),
                6, 3, 1, 5, 8, 2, 7, 4
            );
            trace (theSet.toArray() + "n");
            // 1, 2, 3, 4, 5, 6, 7, 8
            
            // Map
            var map : IMap = Maps.newMap(
                "one", 1, "two", 2, "three", 3, "four", 4
            );
            trace (map.toArray() + "n");
            // 1, 4, 2, 3
            
            // LinkedMap
            map = Maps.newLinkedMap(
                "one", 1, "two", 2, "three", 3, "four", 4
            );
            trace (map.toArray() + "n");
            // 1, 2, 3, 4
            
            // SortedMap
            map = Maps.newSortedMap(
                new NumericComparator(),
                "one", 1, "two", 2, "three", 3, "four", 4
            );
            trace (map.toArray() + "n");
            // 1, 2, 3, 4
            
            // LinkedList
            var linkedList : ILinkedList = LinkedLists.newLinkedList(
                1, 2, 3, 4, 5, 6, 7, 8
            );
            trace (linkedList.toArray() + "n");
            // 1, 2, 3, 4, 5, 6, 7, 8
        }

    }
}
</pre></div></div>
  
  <p id="link_NestedCollectionsExample"><strong>Nested collections example</strong></p>
  
  <a class="exampleCollapsed" href="#link_NestedCollectionsExample" onClick="toggleExample(this, 'NestedCollectionsExample');">Show example</a><br /><div id="NestedCollectionsExample" style='display:none'><div class='listing'><pre>package {
    import org.as3commons.collections.ArrayList;
    import org.as3commons.collections.LinkedSet;
    import org.as3commons.collections.framework.IComparator;
    import org.as3commons.collections.utils.
    import flash.display.Sprite;

    public class NestedCollectionsExample extends Sprite {

        public function NestedCollectionsExample() {
            // nested array list
            var list : ArrayList = Lists.newArrayList(
                Lists.newArrayList(1, 2),
                Lists.newArrayList(
                    Lists.newArrayList(3, 4),
                    Lists.newArrayList(5, 6)
                ),
                Lists.newArrayList(7, 8),
                Lists.newArrayList(
                    Lists.newArrayList(9, 10),
                    Lists.newArrayList(11, 12)
                )
            );
            trace (CollectionUtils.dumpAsString(list));
            //    [object ArrayList]
            //    .......[object ArrayList]
            //    ..............1
            //    ..............2
            //    .......[object ArrayList]
            //    ..............[object ArrayList]
            //    .....................3
            //    .....................4
            //    ..............[object ArrayList]
            //    .....................5
            //    .....................6
            //    .......[object ArrayList]
            //    ..............7
            //    ..............8
            //    .......[object ArrayList]
            //    ..............[object ArrayList]
            //    .....................9
            //    .....................10
            //    ..............[object ArrayList]
            //    .....................11
            //    .....................12            
            
            // nested mixed collection
            var c : IComparator = new NumericComparator();
            var theSet : LinkedSet = Sets.newLinkedSet(
                Maps.newLinkedMap("one", 1, "two", 2),
                Lists.newArrayList(
                    Sets.newSortedSet(c, 4, 3),
                    LinkedLists.newLinkedList(5, 6)
                ),
                Lists.newSortedList(c, 8, 7),
                Lists.newArrayList(
                    Maps.newLinkedMap("nine", 9, "ten", 10),
                    Maps.newSortedMap(c, "twelve", 12, "eleven", 11)
                )
            );
            trace (CollectionUtils.dumpAsString(theSet));
            //    [object LinkedSet]
            //    .......[object LinkedMap]
            //    ..............1
            //    ..............2
            //    .......[object ArrayList]
            //    ..............[object SortedSet]
            //    .....................3
            //    .....................4
            //    ..............[object LinkedList]
            //    .....................5
            //    .....................6
            //    .......[object SortedList]
            //    ..............7
            //    ..............8
            //    .......[object ArrayList]
            //    ..............[object LinkedMap]
            //    .....................9
            //    .....................10
            //    ..............[object SortedMap]
            //    .....................11
            //    .....................12            
        }
    }
}
</pre></div></div>
  
  <p></p>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addFromArgs()">addFromArgs</a>(map:<a href="../framework/IMap.html">IMap</a>, ... args):uint</div>
<div class="summaryTableDescription">[static]
   Adds the given list of key-item-pairs to the specified map.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addFromArray()">addFromArray</a>(map:<a href="../framework/IMap.html">IMap</a>, source:Array):uint</div>
<div class="summaryTableDescription">[static]
   Adds the contents of the given <code>Array</code> to the specified map.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addFromMap()">addFromMap</a>(map:<a href="../framework/IMap.html">IMap</a>, source:<a href="../framework/IMap.html">IMap</a>):uint</div>
<div class="summaryTableDescription">[static]
   Adds the contents of the given <code>IMap</code> to the specified map.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addFromObject()">addFromObject</a>(map:<a href="../framework/IMap.html">IMap</a>, source:Object):uint</div>
<div class="summaryTableDescription">[static]
   Adds the contents of the given <code>Object</code> to the specified map.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#clone()">clone</a>(map:<a href="../framework/IMap.html">IMap</a>, keyFilter:Function = null, itemFilter:Function = null):<a href="../framework/IMap.html">IMap</a>
</div>
<div class="summaryTableDescription">[static]
   Clones the supplied <code>IMap</code> instance returning a new <code>IMap</code>
   of the same type.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#copy()">copy</a>(source:<a href="../framework/IMap.html">IMap</a>, destination:<a href="../framework/IMap.html">IMap</a>, keyFilter:Function = null, itemFilter:Function = null):uint</div>
<div class="summaryTableDescription">[static]
   Copies mappings from one to another map.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#itemForOrAdd()">itemForOrAdd</a>(map:<a href="../framework/IMap.html">IMap</a>, key:*, item:*):*</div>
<div class="summaryTableDescription">[static]
   Attempts to retrieve the item mapped to the supplied key.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#itemForOrError()">itemForOrError</a>(map:<a href="../framework/IMap.html">IMap</a>, key:String, errorMessage:* = null):*</div>
<div class="summaryTableDescription">[static]
   Attempts to retrieve the item mapped to the supplied key.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#itemForOrValue()">itemForOrValue</a>(map:<a href="../framework/IMap.html">IMap</a>, key:*, defaultValue:*):*</div>
<div class="summaryTableDescription">[static]
   Attempts to retrieve the item mapped to the supplied key.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#newLinkedMap()">newLinkedMap</a>(... args):<a href="../../collections/LinkedMap.html">LinkedMap</a>
</div>
<div class="summaryTableDescription">[static]
   Creates, populates and returns a new <code>LinkedMap</code> instance.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#newMap()">newMap</a>(... args):<a href="../../collections/Map.html">Map</a>
</div>
<div class="summaryTableDescription">[static]
   Creates, populates and returns a new <code>Map</code> instance.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#newSortedMap()">newSortedMap</a>(comparator:<a href="../framework/IComparator.html">IComparator</a>, ... args):<a href="../../collections/SortedMap.html">SortedMap</a>
</div>
<div class="summaryTableDescription">[static]
   Creates, populates and returns a new <code>SortedMap</code> instance.</div>
</td><td class="summaryTableOwnerCol">Maps</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="addFromArgs()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addFromArgs</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public static function addFromArgs(map:<a href="../framework/IMap.html">IMap</a>, ... args):uint</code><p>
   Adds the given list of key-item-pairs to the specified map.
   
   <div class='listing'><pre>
    Maps.addFromArgs(myMap, key1, item1, key2, item2, ...);
   </pre></div>
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">map</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; The map to populate.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code>... <span class="label">args</span></code> &mdash; List of key-item-pairs to add to the map.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>uint</code> &mdash; The number of items added to the map.
   </td>
</tr>
</table>
</div>
<a name="addFromArray()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addFromArray</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function addFromArray(map:<a href="../framework/IMap.html">IMap</a>, source:Array):uint</code><p>
   Adds the contents of the given <code>Array</code> to the specified map.
   
   </p><p>The <code>Array</code> needs to be in a key-item-pair shape.</p>
   
   <p>The last <code>Array</code> element is skipped if the size of the Array is not even.</p>
   
   <div class='listing'><pre>
    var array : Array = [key1, item1, key2, item2, ...];
    var count : uint = Maps.addFromArray(map, array);
   </pre></div>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">map</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; The map to populate.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">source</span>:Array</code> &mdash; The <code>Array</code> to add from.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>uint</code> &mdash; The number of items added to the map.
   </td>
</tr>
</table>
</div>
<a name="addFromMap()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addFromMap</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function addFromMap(map:<a href="../framework/IMap.html">IMap</a>, source:<a href="../framework/IMap.html">IMap</a>):uint</code><p>
   Adds the contents of the given <code>IMap</code> to the specified map.
   
   <div class='listing'><pre>
    var count : uint = Maps.addFromMap(map, sourceMap);
   </pre></div>
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">map</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; The map to populate.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">source</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; The <code>IMap</code> to add from.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>uint</code> &mdash; The number of items added to the map.
   </td>
</tr>
</table>
</div>
<a name="addFromObject()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addFromObject</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function addFromObject(map:<a href="../framework/IMap.html">IMap</a>, source:Object):uint</code><p>
   Adds the contents of the given <code>Object</code> to the specified map.
   
   <div class='listing'><pre>
    var count : uint = Maps.addFromObject(map, object);
   </pre></div>
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">map</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; The map to populate.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">source</span>:Object</code> &mdash; The <code>Object</code> to add from.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>uint</code> &mdash; The number of items added to the map.
   </td>
</tr>
</table>
</div>
<a name="clone()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">clone</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function clone(map:<a href="../framework/IMap.html">IMap</a>, keyFilter:Function = null, itemFilter:Function = null):<a href="../framework/IMap.html">IMap</a></code><p>
   Clones the supplied <code>IMap</code> instance returning a new <code>IMap</code>
   of the same type.
   
   </p><p>If filters are specified the resulting map only contains mappings that
   meet the supplied predicates.<p>
   
   <p>The key filter function accepts the current key and returns a boolean
   value (<code>true</code> if the key is accepted).</p>
   
   <div class='listing'><pre>
   function keyFilter(key :  : Boolean {
    var accept : Boolean = false;
    // test the key
    return accept;
   }
     
   var clone : IMap = Maps.clone(map, keyFilter);
   </pre></div>
   
   <p>The item filter function accepts the current item and returns a boolean
   value (<code>true</code> if the item is accepted).</p>
   
   <div class='listing'><pre>
   function itemFilter(item :  : Boolean {
    var accept : Boolean = false;
    // test the item
    return accept;
   }
     
   var clone : IMap = Maps.clone(map, keyFilter, itemFilter);
   </pre></div>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">map</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; The <code>IMap</code> instance to clone.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">keyFilter</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; Function which will be applied to each key in the source map.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">itemFilter</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; Function which will be applied to each item in the source map.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../framework/IMap.html">IMap</a></code> &mdash; 
                        A new <code>IMap</code> instance.
   
                        
                     </td>
</tr>
</table>
</div>
<a name="copy()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">copy</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function copy(source:<a href="../framework/IMap.html">IMap</a>, destination:<a href="../framework/IMap.html">IMap</a>, keyFilter:Function = null, itemFilter:Function = null):uint</code><p>
   Copies mappings from one to another map.
   
   </p><p>If filters are specified only mappings are copied that meet
   the supplied predicates.<p>
   
   <p>The key filter function accepts the current key and returns a boolean
   value (<code>true</code> if the key is accepted).</p>
   
   <div class='listing'><pre>
   function keyFilter(key :  : Boolean {
    var accept : Boolean = false;
    // test the key
    return accept;
   }
     
   Maps.copy(sourceMap, destinationMap, keyFilter);
   </pre></div>
   
   <p>The item filter function accepts the current item and returns a boolean
   value (<code>true</code> if the item is accepted).</p>
   
   <div class='listing'><pre>
   function itemFilter(item :  : Boolean {
    var accept : Boolean = false;
    // test the item
    return accept;
   }
     
   Maps.copy(sourceMap, destinationMap, keyFilter, itemFilter);
   </pre></div>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">source</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; The <code>IMap</code> instance to copy from.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">destination</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; The <code>IMap</code> to copy to.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">keyFilter</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; Function which will be applied to each key in the source map.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">itemFilter</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; Function which will be applied to each item in the source map.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>uint</code> &mdash; The number of items copied to the map.
   </td>
</tr>
</table>
</div>
<a name="itemForOrAdd()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">itemForOrAdd</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function itemForOrAdd(map:<a href="../framework/IMap.html">IMap</a>, key:*, item:*):*</code><p>
   Attempts to retrieve the item mapped to the supplied key.
   
   </p><p>If the supplied key is not mapped then the supplied value will mapped to the key and returned.</p>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">map</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; the IMap instance to operate on.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">key</span>:*</code> &mdash; the key to perform the lookup using.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">item</span>:*</code> &mdash; if no mapping exists for the supplied key a new mapping will be added between the key and 
   this value.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>*</code> &mdash; if a prior mapping exists for the supplied key then the assosiated value in the map will be 
   returned; if no prior mapping exists the supplied value will be returned instead. 
   </td>
</tr>
</table>
</div>
<a name="itemForOrError()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">itemForOrError</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function itemForOrError(map:<a href="../framework/IMap.html">IMap</a>, key:String, errorMessage:* = null):*</code><p>
   Attempts to retrieve the item mapped to the supplied key.
   
   </p><p>If the supplied key is not mapped an ArgumentError will be thrown.</p>
      <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">map</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; the IMap instance to operate on. 
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">key</span>:String</code> &mdash; the key to perform the lookup using.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">errorMessage</span>:*</code> (default = <code>null</code>)<code></code> &mdash; optional error message which will be used if an Error needs to be thrown.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>*</code> &mdash; the item mapped to the supplied key.
   </td>
</tr>
</table>
<br>
<span class="label">Throws</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code></code> &mdash; if no mapping exists for the supplied key.
   </td>
</tr>
</table>
</div>
<a name="itemForOrValue()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">itemForOrValue</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function itemForOrValue(map:<a href="../framework/IMap.html">IMap</a>, key:*, defaultValue:*):*</code><p>
   Attempts to retrieve the item mapped to the supplied key.
   
   </p><p>If the supplied key is not mapped then the supplied default value
   will be returned instead.</p>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">map</span>:<a href="../framework/IMap.html">IMap</a></code> &mdash; the IMap instance to operate on.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">key</span>:*</code> &mdash; the key to perform the lookup using.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">defaultValue</span>:*</code> &mdash; the value to return if the supplied key does not exist in the supplied Map.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>*</code> &mdash; if the supplied key exists in the map then the value mapped to that key will be  returned, otherwise 
   the supplied defaultValue will be returned instead. 
   </td>
</tr>
</table>
</div>
<a name="newLinkedMap()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">newLinkedMap</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function newLinkedMap(... args):<a href="../../collections/LinkedMap.html">LinkedMap</a></code><p>
   Creates, populates and returns a new <code>LinkedMap</code> instance.
   
   </p><p>The arguments may be left out. In that case no item is added to the map.</p>
   
   <p>The last argument is skipped if the size of arguments is not even.</p>
   
   <div class='listing'><pre>
    var map : Map = Maps.newLinkedMap(key1, item1, key2, item2, ...);
   </pre></div>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code>... <span class="label">args</span></code> &mdash; List of key-item-pairs to add to the map.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../../collections/LinkedMap.html">LinkedMap</a></code> &mdash; 
                        A new <code>LinkedMap</code> instance populated from the given arguments.
   
                        
                     </td>
</tr>
</table>
</div>
<a name="newMap()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">newMap</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function newMap(... args):<a href="../../collections/Map.html">Map</a></code><p>
   Creates, populates and returns a new <code>Map</code> instance.
   
   </p><p>The arguments may be left out. In that case no item is added to the map.</p>
   
   <p>The last argument is skipped if the size of arguments is not even.</p>
   
   <div class='listing'><pre>
    var map : Map = Maps.newMap(key1, item1, key2, item2, ...);
   </pre></div>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code>... <span class="label">args</span></code> &mdash; List of key-item-pairs to add to the map.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../../collections/Map.html">Map</a></code> &mdash; 
                        A new <code>Map</code> instance populated from the given arguments.
   
                        
                     </td>
</tr>
</table>
</div>
<a name="newSortedMap()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">newSortedMap</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function newSortedMap(comparator:<a href="../framework/IComparator.html">IComparator</a>, ... args):<a href="../../collections/SortedMap.html">SortedMap</a></code><p>
   Creates, populates and returns a new <code>SortedMap</code> instance.
   
   </p><p>The arguments may be left out. In that case no item is added to the map.</p>
   
   <p>The last argument is skipped if the size of arguments is not even.</p>
   
   <div class='listing'><pre>
    var map : Map = Maps.newSortedMap(key1, item1, key2, item2, ...);
   </pre></div>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">comparator</span>:<a href="../framework/IComparator.html">IComparator</a></code> &mdash; The sort criterion.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code>... <span class="label">args</span></code> &mdash; List of key-item-pairs to add to the map.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../../collections/SortedMap.html">SortedMap</a></code> &mdash; 
                        A new <code>SortedMap</code> instance populated from the given arguments.
   
                        
                     </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
